package top.dark.design.patterns.prototype.deepcopy;

/**
 * Author: Darkn
 * description:
 * Create Time: 2021/4/21 18:04
 */
public class Client {

    public static void main(String[] args) throws CloneNotSupportedException {
        DeepProtoType deepProtoType = new DeepProtoType();
        deepProtoType.name = "李姣";
        deepProtoType.deepCloneableTarget = new DeepCloneableTarget("大牛", "小牛");
        DeepProtoType deepProtoType1 = (DeepProtoType) deepProtoType.clone();
        System.out.println(deepProtoType == deepProtoType1);
        System.out.println(deepProtoType.deepCloneableTarget.hashCode() + " VS "
                + deepProtoType1.deepCloneableTarget.hashCode());
        DeepProtoType deepProtoType2 = (DeepProtoType) deepProtoType.deepClone();
        System.out.println(deepProtoType.deepCloneableTarget.hashCode() + " VS "
                + deepProtoType2.deepCloneableTarget.hashCode());
    }
}
